package com.example.tests;

public class ContactObject {
	public String firstname;
	public String lastname;
	public String address;
	public String home;
	public String mobile;
	public String work;
	public String email;
	public String email2;
	public String bday;
	public String bmonth;
	public String byear;
	public String newgroup;
	public String address2;
	public String phone2;
	public String id;
	public String title;
/*
	public ContactObject(String firstname, String lastname, String address,
			String home, String mobile, String work, String email,
			String email2, String bday, String bmonth, String byear,
			String group, String address2, String phone2) {
		this.firstname = firstname;
		this.lastname = lastname;
		this.address = address;
		this.home = home;
		this.mobile = mobile;
		this.work = work;
		this.email = email;
		this.email2 = email2;
		this.bday = bday;
		this.bmonth = bmonth;
		this.byear = byear;
		this.newgroup = group;
		this.address2 = address2;
		this.phone2 = phone2;
	}
	*/

	public ContactObject setFirstname(String firstname) {
		this.firstname = firstname;
		return this;
	}

	@Override
	public String toString() {
		return "Contact [id=" + id + ", firstname=" + firstname
				+ ", lastname=" + lastname + ", email=" + email + "]";
	}

	public ContactObject setLastname(String lastname) {
		this.lastname = lastname;
		this.title = this.firstname + " " + this.lastname;
		return this;
	}

	public ContactObject setAddress(String address) {
		this.address = address;
		return this;
	}

	public ContactObject setHome(String home) {
		this.home = home;
		return this;
	}

	public ContactObject setMobile(String mobile) {
		this.mobile = mobile;
		return this;
	}

	public ContactObject setWork(String work) {
		this.work = work;
		return this;
	}

	public ContactObject setEmail(String email) {
		this.email = email;
		return this;
	}

	public ContactObject setEmail2(String email2) {
		this.email2 = email2;
		return this;
	}

	public ContactObject setBday(String bday) {
		this.bday = bday;
		return this;
	}

	public ContactObject setBmonth(String bmonth) {
		this.bmonth = bmonth;
		return this;
	}

	public ContactObject setByear(String byear) {
		this.byear = byear;
		return this;
	}

	public ContactObject setNewgroup(String newgroup) {
		this.newgroup = newgroup;
		return this;
	}

	public ContactObject setAddress2(String address2) {
		this.address2 = address2;
		return this;
	}

	public ContactObject setPhone2(String phone2) {
		this.phone2 = phone2;
		return this;
	}
	
	public ContactObject setId(String id) {
		this.id = id;
		return this;
	}
	
	public ContactObject setTitle(String title) {
		this.title = title;
		return this;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		//result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result + ((title == null) ? 0 : title.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ContactObject other = (ContactObject) obj;
		if (title == null) {
			if (other.title != null)
				return false;
		} else if (!title.equals(other.title))
			return false;
		if (id != null && other.id != null) {
			return id.equals(other.id);
		}
		return true;
	}

}